<?php
header("Content-Type:application/json;charset=utf-8");
$arr = [
    "name" => "tom",
    "age" => 20,
    "sex" => "男"
];
// 转json字符串
echo json_encode($arr);
?>